package com.it.web;

import com.it.entity.dispatch.AiClaimDispatch;
import com.it.entity.insure.AiFarmerInsured;
import com.it.service.AiFarmerInsuredService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import utils.R;

/**
 * <p>
 * 农户（投保人）信息表 前端控制器
 * </p>
 *
 * @author yzy
 * @since 2025年09月17日
 */
@RestController
@RequestMapping("/aiFarmerInsured")
public class AiFarmerInsuredController {

    @Autowired
    private AiFarmerInsuredService aiFarmerInsuredService;

    // 新增或修改农户信息
    @PostMapping("/addOrUpdate")
    public R add(@RequestBody AiFarmerInsured aiFarmerInsured) {
        return aiFarmerInsuredService.addOrUpdate(aiFarmerInsured);
    }

    // 根据农户姓名和手机号模糊查询
    @GetMapping("/searchPolicy")
    public R get(@RequestParam("phone") String phone, @RequestParam("name") String name) {
        return aiFarmerInsuredService.searchPolicy(phone,name);
    }

}
